//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package org.jooq.util.oracle;

import org.jooq.Configuration;
import org.jooq.ConnectionCallable;
import org.jooq.Field;
import org.jooq.QueryPart;
import org.jooq.SQLDialect;
import org.jooq.Support;
import org.jooq.TransactionalCallable;
import org.jooq.UDTRecord;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.tools.jdbc.JDBCUtils;

import java.math.BigDecimal;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Executor;
import java.util.stream.Stream;

public class OracleDSL extends DSL {
    protected OracleDSL() {
    }

    @Support({SQLDialect.ORACLE})
    public static Field<Integer> rownum() {
        return DSL.rownum();
    }

    @Support({SQLDialect.ORACLE})
    public static Field<String> rowid() {
        return field("rowid", String.class);
    }

    @Support({SQLDialect.ORACLE})
    public static Field<Long> rowscn() {
        return oraRowscn();
    }

    @Support({SQLDialect.ORACLE})
    public static Field<Long> oraRowscn() {
        return field("ora_rowscn", Long.class);
    }

    @Support({SQLDialect.ORACLE})
    public static Field<Timestamp> scnToTimestamp(Number scn) {
        return scnToTimestamp((Field)val(scn));
    }

    @Support({SQLDialect.ORACLE})
    public static Field<Timestamp> scnToTimestamp(Field<? extends Number> scn) {
        return function("scn_to_timestamp", SQLDataType.TIMESTAMP, new Field[]{nullSafe(scn)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<Long> timestampToScn(Date timestamp) {
        return timestampToScn((Field)val(timestamp));
    }

    @Support({SQLDialect.ORACLE})
    public static Field<Long> timestampToScn(Field<? extends Date> scn) {
        return function("timestamp_to_scn", SQLDataType.BIGINT, new Field[]{nullSafe(scn)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<String> sysContext(String namespace, String parameter) {
        return function("sys_context", SQLDataType.VARCHAR, new Field[]{val(namespace), val(parameter)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<String> sysContext(String namespace, String parameter, int length) {
        return function("sys_context", SQLDataType.VARCHAR, new Field[]{val(namespace), val(parameter), val(length)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<String> toChar(Object value) {
        return toChar((Field)val(value));
    }

    @Support({SQLDialect.ORACLE})
    public static Field<String> toChar(Field<?> value) {
        return field("{to_char}({0})", String.class, new QueryPart[]{nullSafe(value)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<String> toChar(Object value, String formatMask) {
        return toChar((Field)val(value), (Field)val(formatMask));
    }

    @Support({SQLDialect.ORACLE})
    public static Field<String> toChar(Object value, Field<String> formatMask) {
        return toChar((Field)val(value), (Field)formatMask);
    }

    @Support({SQLDialect.ORACLE})
    public static Field<String> toChar(Field<?> value, String formatMask) {
        return toChar((Field)value, (Field)val(formatMask));
    }

    @Support({SQLDialect.ORACLE})
    public static Field<String> toChar(Field<?> value, Field<String> formatMask) {
        return field("{to_char}({0}, {1})", String.class, new QueryPart[]{nullSafe(value), nullSafe(formatMask)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<BigDecimal> toNumber(String value) {
        return toNumber((Field)val(value));
    }

    @Support({SQLDialect.ORACLE})
    public static Field<BigDecimal> toNumber(Field<String> value) {
        return field("{to_number}({0})", BigDecimal.class, new QueryPart[]{nullSafe(value)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<BigDecimal> toNumber(String value, String formatMask) {
        return toNumber((Field)val(value), (Field)val(formatMask));
    }

    @Support({SQLDialect.ORACLE})
    public static Field<BigDecimal> toNumber(String value, Field<String> formatMask) {
        return toNumber((Field)val(value), (Field)formatMask);
    }

    @Support({SQLDialect.ORACLE})
    public static Field<BigDecimal> toNumber(Field<String> value, String formatMask) {
        return toNumber((Field)value, (Field)val(formatMask));
    }

    @Support({SQLDialect.ORACLE})
    public static Field<BigDecimal> toNumber(Field<String> value, Field<String> formatMask) {
        return field("{to_number}({0}, {1})", BigDecimal.class, new QueryPart[]{nullSafe(value), nullSafe(formatMask)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<Long> versionsStartscn() {
        return field("{versions_startscn}", Long.class);
    }

    @Support({SQLDialect.ORACLE})
    public static Field<Timestamp> versionsStarttime() {
        return field("{versions_starttime}", Timestamp.class);
    }

    @Support({SQLDialect.ORACLE})
    public static Field<Long> versionsEndscn() {
        return field("{versions_endscn}", Long.class);
    }

    @Support({SQLDialect.ORACLE})
    public static Field<Timestamp> versionsEndtime() {
        return field("{versions_endtime}", Timestamp.class);
    }

    @Support({SQLDialect.ORACLE})
    public static Field<String> versionsXid() {
        return field("{versions_xid}", String.class);
    }

    @Support({SQLDialect.ORACLE})
    public static Field<String> versionsOperation() {
        return field("{versions_operation}", String.class);
    }

    @Support({SQLDialect.ORACLE})
    public static Field<BigDecimal> contains(Field<String> field, String query) {
        return field("{contains}({0}, {1})", SQLDataType.NUMERIC, new QueryPart[]{nullSafe(field), val(query)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<BigDecimal> contains(Field<String> field, String query, int label) {
        return field("{contains}({0}, {1}, {2})", SQLDataType.NUMERIC, new QueryPart[]{nullSafe(field), val(query), inline(label)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<BigDecimal> matches(Field<String> field, String query) {
        return field("{matches}({0}, {1})", SQLDataType.NUMERIC, new QueryPart[]{nullSafe(field), val(query)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<BigDecimal> matches(Field<String> field, String query, int label) {
        return field("{matches}({0}, {1}, {2})", SQLDataType.NUMERIC, new QueryPart[]{nullSafe(field), val(query), inline(label)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<BigDecimal> catsearch(Field<String> field, String textQuery, String structuredQuery) {
        return field("{catsearch}({0}, {1}, {2})", SQLDataType.NUMERIC, new QueryPart[]{nullSafe(field), val(textQuery), val(structuredQuery)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<BigDecimal> score(int label) {
        return field("{score}({0})", SQLDataType.NUMERIC, new QueryPart[]{inline(label)});
    }

    @Support({SQLDialect.ORACLE})
    public static Field<BigDecimal> matchScore(int label) {
        return field("{match_score}({0})", SQLDataType.NUMERIC, new QueryPart[]{inline(label)});
    }

    public static final class DBMS_AQ {
        public static <R extends UDTRecord<R>> void enqueue(Configuration configuration, Queue<R> queue, R payload) {
            enqueue(configuration, queue, payload, (OracleDSL.DBMS_AQ.ENQUEUE_OPTIONS_T)null, (OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T)null);
        }

        public static <R extends UDTRecord<R>> void enqueue(Configuration configuration, Queue<R> queue, R payload, OracleDSL.DBMS_AQ.ENQUEUE_OPTIONS_T options, OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T properties) {
            if (options == null) {
                options = new OracleDSL.DBMS_AQ.ENQUEUE_OPTIONS_T();
            }

            if (properties == null) {
                properties = new OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T();
            }

            List<Object> bindings = new ArrayList();
            if (options.transformation != null) {
                bindings.add(options.transformation);
            }

            if (properties.correlation != null) {
                bindings.add(properties.correlation);
            }

            if (properties.delay != null) {
                bindings.add(properties.delay);
            }

            if (properties.enqueue_time != null) {
                bindings.add(properties.enqueue_time);
            }

            if (properties.exception_queue != null) {
                bindings.add(properties.exception_queue);
            }

            if (properties.expires != null) {
                bindings.add(properties.expires);
            }

            if (properties.priority != null) {
                bindings.add(properties.priority);
            }

            if (properties.state != null) {
                bindings.add(properties.state);
            }

            if (properties.transaction_group != null) {
                bindings.add(properties.transaction_group);
            }

            bindings.add(queue.name());
            bindings.add(payload);
            DSL.using(configuration).execute("DECLARE\n  v_msgid              RAW(16);\n  v_enqueue_options    DBMS_AQ.enqueue_options_t;\n  v_message_properties DBMS_AQ.message_properties_t;\nBEGIN" + (options.transformation == null ? "" : "\n  v_enqueue_options.transformation       := ?;") + (options.delivery_mode == null ? "" : "\n  v_enqueue_options.delivery_mode        := DBMS_AQ." + options.delivery_mode.name() + ";") + (options.sequence_deviation == null ? "" : "\n  v_enqueue_options.sequence_deviation   := DBMS_AQ." + options.sequence_deviation.name() + ";") + (options.visibility == null ? "" : "\n  v_enqueue_options.visibility           := DBMS_AQ." + options.visibility.name() + ";") + (properties.correlation == null ? "" : "\n  v_message_properties.correlation       := ?;") + (properties.delay == null ? "" : "\n  v_message_properties.delay             := ?;") + (properties.delivery_mode == null ? "" : "\n  v_message_properties.delivery_mode     := DBMS_AQ." + properties.delivery_mode.name() + ";") + (properties.enqueue_time == null ? "" : "\n  v_message_properties.enqueue_time      := ?;") + (properties.exception_queue == null ? "" : "\n  v_message_properties.exception_queue   := ?;") + (properties.expires == null ? "" : "\n  v_message_properties.expiration        := ?;") + (properties.priority == null ? "" : "\n  v_message_properties.priority          := ?;") + (properties.state == null ? "" : "\n  v_message_properties.state             := ?;") + (properties.transaction_group == null ? "" : "\n  v_message_properties.transaction_group := ?;") + "\n  DBMS_AQ.ENQUEUE(\n    queue_name         => ?,\n    enqueue_options    => v_enqueue_options,\n    message_properties => v_message_properties,\n    payload            => ?,\n    msgid              => v_msgid\n  );\nEND;", bindings.toArray());
        }

        public static <R extends UDTRecord<R>> Iterable<R> dequeueIterable(Configuration configuration, Queue<R> queue) {
            return dequeueIterable(configuration, queue, (OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T)null, (OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T)null);
        }

        public static <R extends UDTRecord<R>> Iterable<R> dequeueIterable(Configuration configuration, Queue<R> queue, OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T options) {
            return dequeueIterable(configuration, queue, options, (OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T)null);
        }

        public static <R extends UDTRecord<R>> Iterable<R> dequeueIterable(final Configuration configuration, final Queue<R> queue, final OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T options, final OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T properties) {
            return new Iterable<R>() {
                public Iterator<R> iterator() {
                    return new Iterator<R>() {
                        public boolean hasNext() {
                            return true;
                        }

                        public R next() {
                            return (R)DSL.using(configuration).transactionResult(new TransactionalCallable<R>() {
                                public R run(Configuration c) {
                                    return OracleDSL.DBMS_AQ.dequeue(c, queue, options, properties);
                                }
                            });
                        }

                        public void remove() {
                            throw new UnsupportedOperationException("remove");
                        }
                    };
                }
            };
        }

        public static <R extends UDTRecord<R>> Stream<R> dequeueStream(Configuration configuration, Queue<R> queue) {
            return dequeueStream(configuration, queue, (OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T)null, (OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T)null);
        }

        public static <R extends UDTRecord<R>> Stream<R> dequeueStream(Configuration configuration, Queue<R> queue, OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T options) {
            return dequeueStream(configuration, queue, options, (OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T)null);
        }

        public static <R extends UDTRecord<R>> Stream<R> dequeueStream(Configuration configuration, Queue<R> queue, OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T options, OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T properties) {
            return Stream.generate(() -> {
                return (R)DSL.using(configuration).transactionResult((c) -> {
                    return dequeue(c, queue, options, properties);
                });
            });
        }

        public static <R extends UDTRecord<R>> CompletionStage<R> dequeueAsync(Configuration configuration, Queue<R> queue) {
            return dequeueAsync((Configuration)configuration, (Queue)queue, (OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T)null, (OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T)null);
        }

        public static <R extends UDTRecord<R>> CompletionStage<R> dequeueAsync(Configuration configuration, Queue<R> queue, OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T options) {
            return dequeueAsync((Configuration)configuration, (Queue)queue, (OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T)options, (OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T)null);
        }

        public static <R extends UDTRecord<R>> CompletionStage<R> dequeueAsync(Configuration configuration, Queue<R> queue, OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T options, OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T properties) {
            return DSL.using(configuration).transactionResultAsync((c) -> {
                return dequeue(c, queue, options, properties);
            });
        }

        public static <R extends UDTRecord<R>> CompletionStage<R> dequeueAsync(Executor executor, Configuration configuration, Queue<R> queue) {
            return dequeueAsync(executor, configuration, queue, (OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T)null, (OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T)null);
        }

        public static <R extends UDTRecord<R>> CompletionStage<R> dequeueAsync(Executor executor, Configuration configuration, Queue<R> queue, OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T options) {
            return dequeueAsync(executor, configuration, queue, options, (OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T)null);
        }

        public static <R extends UDTRecord<R>> CompletionStage<R> dequeueAsync(Executor executor, Configuration configuration, Queue<R> queue, OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T options, OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T properties) {
            return DSL.using(configuration).transactionResultAsync(executor, (c) -> {
                return dequeue(c, queue, options, properties);
            });
        }

        public static <R extends UDTRecord<R>> R dequeue(Configuration configuration, Queue<R> queue) {
            return dequeue(configuration, queue, (OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T)null, (OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T)null);
        }

        public static <R extends UDTRecord<R>> R dequeue(Configuration configuration, Queue<R> queue, OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T options) {
            return dequeue(configuration, queue, options, (OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T)null);
        }

        public static <R extends UDTRecord<R>> R dequeue(Configuration configuration, final Queue<R> queue, OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T options, final OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T properties) {
            final OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T opt = options != null ? options : new OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T();
            final String sql = "DECLARE\n  v_msgid              RAW(16);\n  v_dequeue_options    DBMS_AQ.dequeue_options_t;\n  v_message_properties DBMS_AQ.message_properties_t;\nBEGIN" + (opt.consumer_name == null ? "" : "\n  v_dequeue_options.consumer_name        := ?;") + (opt.correlation == null ? "" : "\n  v_dequeue_options.correlation          := ?;") + (opt.deq_condition == null ? "" : "\n  v_dequeue_options.deq_condition        := ?;") + (opt.transformation == null ? "" : "\n  v_dequeue_options.transformation       := ?;") + (opt.delivery_mode == null ? "" : "\n  v_dequeue_options.delivery_mode        := DBMS_AQ." + opt.delivery_mode.name() + ";") + (opt.dequeue_mode == null ? "" : "\n  v_dequeue_options.dequeue_mode         := DBMS_AQ." + opt.dequeue_mode.name() + ";") + (opt.navigation == null ? "" : "\n  v_dequeue_options.navigation           := DBMS_AQ." + opt.navigation.name() + ";") + (opt.visibility == null ? "" : "\n  v_dequeue_options.visibility           := DBMS_AQ." + opt.visibility.name() + ";") + (opt.wait_seconds == null ? "" : "\n  v_dequeue_options.wait                 := ?;") + (opt.wait_seconds == null && opt.wait != null ? "\n  v_dequeue_options.wait                 := DBMS_AQ." + opt.wait.name() + ";" : "") + "\n  DBMS_AQ.DEQUEUE(\n    queue_name         => ?,\n    dequeue_options    => v_dequeue_options,\n    message_properties => v_message_properties,\n    payload            => ?,\n    msgid              => v_msgid\n  );" + (properties == null ? "" : "\n  ? := v_message_properties.attempts;") + (properties == null ? "" : "\n  ? := v_message_properties.correlation;") + (properties == null ? "" : "\n  ? := v_message_properties.delay;") + (properties == null ? "" : "\n  ? := CASE v_message_properties.delivery_mode \n       WHEN DBMS_AQ.BUFFERED   THEN 'BUFFERED'\n       WHEN DBMS_AQ.PERSISTENT THEN 'PERSISTENT'\n                               ELSE 'PERSISTENT_OR_BUFFERED' END;") + (properties == null ? "" : "\n  ? := v_message_properties.enqueue_time;") + (properties == null ? "" : "\n  ? := v_message_properties.exception_queue;") + (properties == null ? "" : "\n  ? := v_message_properties.expiration;") + (properties == null ? "" : "\n  ? := v_message_properties.priority;") + (properties == null ? "" : "\n  ? := v_message_properties.state;") + (properties == null ? "" : "\n  ? := v_message_properties.transaction_group;") + "\nEND;";
            return (R)DSL.using(configuration).connectionResult(new ConnectionCallable<R>() {
                public R run(Connection connection) throws Exception {
                    CallableStatement stmt = null;

                    R var8;
                    try {
                        int i = 1;
                        stmt = connection.prepareCall(sql);
                        if (opt.consumer_name != null) {
                            stmt.setString(i++, opt.consumer_name);
                        }

                        if (opt.correlation != null) {
                            stmt.setString(i++, opt.correlation);
                        }

                        if (opt.deq_condition != null) {
                            stmt.setString(i++, opt.deq_condition);
                        }

                        if (opt.transformation != null) {
                            stmt.setString(i++, opt.transformation);
                        }

                        if (opt.wait_seconds != null) {
                            stmt.setInt(i++, opt.wait_seconds);
                        }

                        boolean payloadIndexx = true;
                        int propertiesIndex = 1;
                        stmt.setString(i++, queue.name());
                        int payloadIndex;
                        stmt.registerOutParameter(payloadIndex = i++, 2002, queue.type().getName());
                        if (properties != null) {
                            propertiesIndex = i;
                            stmt.registerOutParameter(i++, 4);
                            stmt.registerOutParameter(i++, 12);
                            stmt.registerOutParameter(i++, 2);
                            stmt.registerOutParameter(i++, 12);
                            stmt.registerOutParameter(i++, 93);
                            stmt.registerOutParameter(i++, 12);
                            stmt.registerOutParameter(i++, 2);
                            stmt.registerOutParameter(i++, 4);
                            stmt.registerOutParameter(i++, 4);
                            stmt.registerOutParameter(i++, 12);
                        }

                        stmt.execute();
                        Map<String, Class<?>> map = new HashMap();
                        map.put(queue.type().getName(), queue.type().getRecordType());
                        R result = (R)stmt.getObject(payloadIndex, map);
                        if (properties != null) {
                            properties.attempts = stmt.getInt(propertiesIndex++);
                            properties.correlation = stmt.getString(propertiesIndex++);
                            properties.delay = stmt.getBigDecimal(propertiesIndex++);
                            properties.delivery_mode = OracleDSL.DBMS_AQ.DELIVERY_MODE.valueOf(stmt.getString(propertiesIndex++));
                            properties.enqueue_time = stmt.getTimestamp(propertiesIndex++);
                            properties.exception_queue = stmt.getString(propertiesIndex++);
                            properties.expires = stmt.getBigDecimal(propertiesIndex++);
                            properties.priority = stmt.getInt(propertiesIndex++);
                            properties.state = stmt.getInt(propertiesIndex++);
                            properties.transaction_group = stmt.getString(propertiesIndex++);
                        }

                        var8 = result;
                    } finally {
                        JDBCUtils.safeClose(stmt);
                    }

                    return var8;
                }
            });
        }

        private DBMS_AQ() {
        }

        public static final class MESSAGE_PROPERTIES_T {
            public Integer priority;
            public BigDecimal delay;
            public BigDecimal expiration;
            public String correlation;
            public Integer attempts;
            public String exception_queue;
            public Timestamp enqueue_time;
            public Integer state;
            public String transaction_group;
            public OracleDSL.DBMS_AQ.DELIVERY_MODE delivery_mode;
            /** @deprecated */
            @Deprecated
            public BigDecimal expires;

            public MESSAGE_PROPERTIES_T() {
            }

            public OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T priority(Integer newValue) {
                this.priority = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T delay(BigDecimal newValue) {
                this.delay = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T expiration(BigDecimal newValue) {
                this.expires = newValue;
                this.expiration = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T correlation(String newValue) {
                this.correlation = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T attempts(Integer newValue) {
                this.attempts = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T exception_queue(String newValue) {
                this.exception_queue = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T enqueue_time(Timestamp newValue) {
                this.enqueue_time = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T state(Integer newValue) {
                this.state = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T transaction_group(String newValue) {
                this.transaction_group = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T delivery_mode(OracleDSL.DBMS_AQ.DELIVERY_MODE newValue) {
                this.delivery_mode = newValue;
                return this;
            }

            /** @deprecated */
            @Deprecated
            public OracleDSL.DBMS_AQ.MESSAGE_PROPERTIES_T expires(BigDecimal newValue) {
                this.expires = newValue;
                this.expiration = newValue;
                return this;
            }
        }

        public static final class ENQUEUE_OPTIONS_T {
            public OracleDSL.DBMS_AQ.VISIBILITY visibility;
            public OracleDSL.DBMS_AQ.SEQUENCE_DEVIATION sequence_deviation;
            public String transformation;
            public OracleDSL.DBMS_AQ.DELIVERY_MODE delivery_mode;

            public ENQUEUE_OPTIONS_T() {
            }

            public OracleDSL.DBMS_AQ.ENQUEUE_OPTIONS_T visibility(OracleDSL.DBMS_AQ.VISIBILITY newValue) {
                this.visibility = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.ENQUEUE_OPTIONS_T sequence_deviation(OracleDSL.DBMS_AQ.SEQUENCE_DEVIATION newValue) {
                this.sequence_deviation = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.ENQUEUE_OPTIONS_T transformation(String newValue) {
                this.transformation = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.ENQUEUE_OPTIONS_T delivery_mode(OracleDSL.DBMS_AQ.DELIVERY_MODE newValue) {
                this.delivery_mode = newValue;
                return this;
            }
        }

        public static final class DEQUEUE_OPTIONS_T {
            public String consumer_name;
            public OracleDSL.DBMS_AQ.DEQUEUE_MODE dequeue_mode;
            public OracleDSL.DBMS_AQ.NAVIGATION navigation;
            public OracleDSL.DBMS_AQ.VISIBILITY visibility;
            public OracleDSL.DBMS_AQ.WAIT wait;
            public Integer wait_seconds;
            public String correlation;
            public String deq_condition;
            public String transformation;
            public OracleDSL.DBMS_AQ.DELIVERY_MODE delivery_mode;

            public DEQUEUE_OPTIONS_T() {
            }

            public OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T consumer_name(String newValue) {
                this.consumer_name = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T dequeue_mode(OracleDSL.DBMS_AQ.DEQUEUE_MODE newValue) {
                this.dequeue_mode = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T navigation(OracleDSL.DBMS_AQ.NAVIGATION newValue) {
                this.navigation = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T visibility(OracleDSL.DBMS_AQ.VISIBILITY newValue) {
                this.visibility = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T wait(OracleDSL.DBMS_AQ.WAIT newValue) {
                this.wait = newValue;
                this.wait_seconds = null;
                return this;
            }

            public OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T wait(int newValue) {
                this.wait = null;
                this.wait_seconds = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T correlation(String newValue) {
                this.correlation = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T deq_condition(String newValue) {
                this.deq_condition = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T transformation(String newValue) {
                this.transformation = newValue;
                return this;
            }

            public OracleDSL.DBMS_AQ.DEQUEUE_OPTIONS_T delivery_mode(OracleDSL.DBMS_AQ.DELIVERY_MODE newValue) {
                this.delivery_mode = newValue;
                return this;
            }
        }

        public static enum SEQUENCE_DEVIATION {
            BEFORE,
            TOP;

            private SEQUENCE_DEVIATION() {
            }
        }

        public static enum DELIVERY_MODE {
            BUFFERED,
            PERSISTENT,
            PERSISTENT_OR_BUFFERED;

            private DELIVERY_MODE() {
            }
        }

        public static enum WAIT {
            FOREVER,
            NO_WAIT;

            private WAIT() {
            }
        }

        public static enum VISIBILITY {
            ON_COMMIT,
            IMMEDIATE;

            private VISIBILITY() {
            }
        }

        public static enum NAVIGATION {
            NEXT_MESSAGE,
            NEXT_TRANSACTION,
            NEXT_MESSAGE_MULTI_GROUP,
            FIRST_MESSAGE,
            FIRST_MESSAGE_MULTI_GROUP;

            private NAVIGATION() {
            }
        }

        public static enum DEQUEUE_MODE {
            BROWSE,
            LOCKED,
            REMOVE,
            REMOVE_NODATA;

            private DEQUEUE_MODE() {
            }
        }
    }
}
